<!-- Transaction Information -->
<div class="row">
    <div class="col-xs-12">
        <div class="panel panel-default table-responsive">
            <div class="panel-heading panel-heading-lg">
                <i class="fa fa-lg fa-bullhorn "></i> Broadcast Details
                <a href="#" class="btn btn-xs btn-success pull-right" id="history-info-more" target="_blank"><i class="fa fa-info-circle"></i> more info</a>
            </div>
            <table class="table table-striped table-bordered table-condensed">
            <tbody>
            <tr>
                <td class="info bold nowrap" width="130">Transaction Hash</td>
                <td id="tx-hash"></td>
            </tr>
            <tr>
                <td class="info bold" width="130">TX Index</td>
                <td id="tx-index"></td>
            </tr>
            <tr>
                <td class="info bold">Block #</td>
                <td id="block"></td>
            </tr>
            <tr>
                <td class="info bold">Time</td>
                <td id="timestamp"></td>
            </tr>
            <tr>
                <td class="info bold">Source</td>
                <td id="source"></td>
            </tr>
            <tr>
                <td class="info bold">Message</td>
                <td id="broadcast-text"></td>
            </tr>
            <tr>
                <td class="info bold">Fee</td>
                <td id="fee"></td>
            </tr>
            <tr>
                <td class="info bold">Value</td>
                <td id="broadcast-value"></td>
            </tr>
            <tr>
                <td class="info bold">Status</td>
                <td id="status"></td>
            </tr>
            </tbody>
            </table>
        </div>
    </div>
</div><!-- end row -->

<!-- Code to load/update data -->
<script type="text/javascript">
    var tx = FW.CURRENT_TRANSACTION.tx;

    $(document).ready(function(){

        // Update 'more info' link to point to transaction url
        $('#history-info-more').attr('href',FW.EXPLORER_API + '/tx/' + tx);

        // Request transaction information
        $.getJSON(FW.EXPLORER_API + '/api/tx/' + tx, function( o ){
            if(!o.error){
                $('#broadcast-text').text(o.text);
                $('#broadcast-value').text(o.value);
                $('#source').html(o.source);
                $('#tx-hash').html(o.tx_hash);
                $('#fee').text(o.fee);
                $('#status').text(o.status);
                $('#timestamp').html('<span data-livestamp='  + o.timestamp + ' class="nowrap"></span>');
                if(o.tx_index){
                    $('#block').html(numeral(o.block_index).format('0,0'));
                    $('#tx-index').text(numeral(o.tx_index).format('0,0'));
                } else {
                    $('#block').text('-');
                    $('#tx-index').text('-');
                }
            }
        });   

    });

</script>
